import { EBulletFromType } from './Enum'

export default class Bullet extends Laya.Script {
    constructor() { super(); }

    onEnable(): void {

    }

    setVelocity(x: number, y: number): void {
        let rig: Laya.RigidBody = this.owner.getComponent(Laya.RigidBody);
        rig.setVelocity({ x, y })
    }

    onTriggerEnter(other): void {
        if(other.label === 'cEnemy'){
            this.owner.removeSelf();
        }
    }

    onDisable(): void {
        Laya.Pool.recover('bullet', this.owner)
    }
}